package com.jielin.handling.controller.policeplatform;


import com.alibaba.fastjson.JSONObject;
import com.jielin.handling.Annotation.MyPower;
import com.jielin.handling.bean.AppResult;
import com.jielin.handling.service.policeplatform.InquestionsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created by T470 on 2018/7/26.
 */
@CrossOrigin
@RestController
@RequestMapping("/Inquestions/")
@Slf4j
@MyPower(name = "获取警综数据", url = "/InquestionsController")
public class InquestionsController {

    @Autowired
    private InquestionsService inquestionsService;


    /**
     * 根据单位编号查询此单位的案件
     * @param unitCode      办理此案件单位的单位编号
     * @param registTime    案件登记时间
     * @return
     */

    @MyPower(name = "查询此单位的案件", url = "/getCaseByUnitCode")
    @RequestMapping("getCaseByUnitCode")
    public AppResult getCaseByUnitCode(Map<String,Object> map) {
        AppResult appResult = new AppResult();
        JSONObject date = new JSONObject();
        List<Map> list =inquestionsService.getCaseByUnitCode(map);
            date.put("list", list);
            appResult.setCode(200);
            appResult.setMsg("查询此单位的案件成功");
            appResult.setData(date);
        return appResult;
    }


    /**0
     * 根据按键编码获取案件相关人员
     * @param caseNum   案件编号
     * @return
     */
    @MyPower(name = "根据按键编码获取案件相关人员", url = "/getSuspect")
    @RequestMapping("getSuspect")
    @ResponseBody
    public AppResult getSuspect(Map<String,String> map){
        AppResult appResult = new AppResult();
        JSONObject date = new JSONObject();
        List<Map> list= inquestionsService.getSuspect(map);
            date.put("list", list);
            appResult.setCode(200);
            appResult.setMsg("根据按键编码获取案件相关人员成功");
            appResult.setData(date);
        return appResult;
    }
}
